package com.service.Impl;

import java.util.List;

import com.service.OrderService;
import org.apache.ibatis.session.SqlSession;

import com.dao.OrderDAO;
import com.dao.OrderItemDAO;
import com.entity.Order;
import com.entity.OrderItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {
	@Autowired
	private OrderDAO orderDAO;
	@Autowired
	private OrderItemDAO orderItemDAO;
	@Override
	public void insertOrder(Order o,List<OrderItem> oiList) {

			orderDAO.insertOrder(o);
			for (OrderItem orderItem : oiList) {
				orderItemDAO.insertOrderItem(orderItem);
			}

	}

	@Override
	public List<Order> selectOrderById(Integer userId) {
		List<Order> list=orderDAO.selectOrderById(userId);
		return list;
	}
}
